﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PagedList;
namespace Xwork.SEO.WebSite.Controllers
{
    [UserAuthorize(RequireAdmin = true)]
    public class ManagerController : SEOController
    {
        //
        // GET: /Manager/

        public ActionResult Index()
        {
            
            return View();
        }


        public ActionResult UserList(int? pageIndex)
        {
            return View(db.Users.OrderByDescending(p => p.ID).ToPagedList(pageIndex.HasValue ? pageIndex.Value : 1, 20));
        }
        [HttpPost]
        public ActionResult setAuthed(int id)
        {
            User user = db.Users.Find(id);
            if (user != null)
            {
                user.IsAuthenticated = true;
                db.SaveChanges();
                return Json("操作成功");
            }

            return Json(new { error = "用户ID不存在" });
        }


        public ActionResult AccountLogs()
        {
            return View();
        }

        public ActionResult SeoLogs()
        {
            return View();
        }

        public ActionResult SiteList()
        {
            return View();
        }

        public ActionResult Keywords()
        {
            return View();
        }
    }
}
